import sys, os
from typing import List
file_path = os.path.split(os.path.realpath(__file__))[0]
parent = os.path.dirname(file_path)
sys.path.append(parent)
os.chdir(parent)
__package__ = os.path.basename(file_path)


from .column import Column, PrimaryKey
from .TSModel import TSModel
from .filter import Filter

from .client import init_tb_client, client
from .utils import hash_id

init_tb_client(end_point='https://***.cn-shenzhen.ots.aliyuncs.com', access_key_id='***', access_key_secret='***', instance_name='***'
               )

class Test(TSModel):
    __table__ = 'your_table_name'
    
    id = PrimaryKey(index=0)
    aid = PrimaryKey(index=1, sec_index_tb_name='二级索引表名')
    
    
    

if __name__ == "__main__" :

    # test = Test.find_by_pk([hash_id('445845'), 445845, '00011'])
    models = Test.query_by_pk(pk_filters=[
        Filter.is_(Test.aid, 445845)
    ])
    print(models)